
#ifndef _UNION_CONFIG_H_
#define _UNION_CONFIG_H_

#include <unordered_map>
#include <vector>
#include <list>
#include "base.h"

#include "../../3rd/libjson/json.h"

class CItemTpl
{
public:
	CItemTpl()
	{
		Clear();
	}
	void Clear()
	{
		itemid = 0;
		count = 0;
	}
	void LoadFromJson(const Json::Value& itemjson);
public:
	int32_t itemid;//道具ID
	int32_t count;//数量
};

typedef std::list<CItemTpl> TITEM_LIST;

class CItemTplList
{
public:
	void LoadFromJson(const Json::Value& itemlist);
	CItemTplList()
	{
		item_list_.clear();
		item_json_list_.clear();
	}
	const Json::Value& GetJsonItemList() const { return item_json_list_; }
	const TITEM_LIST& GetItemList()const { return item_list_; }
	void GetMailJsonItem(Json::Value&) const;
private:
	TITEM_LIST item_list_;
	Json::Value item_json_list_;
};

class CItemExpense
{
public:
	CItemExpense() {
		Clear();
	}
	void Clear() {
		itemid = 0;
		count = 0;
		begin_id = 0;
		end_id = 0;
	}
	void LoadFromJson(const Json::Value& itemjson);
public:
	int32_t itemid;	// 道具id
	int32_t count;	// 数据量
	int32_t begin_id;
	int32_t end_id;
};

class CUnionLvCfg
{
public:
	CUnionLvCfg()
	{
		guild_exp = 0;
		gold_contribution = 0;
		diamond_contribution = 0;
		gold_sign = 0;
		diamond_sign = 0;
		guild_shop = 0;
		upper_limit = 0;
		gold_reward[0].Clear();
		gold_reward[1].Clear();
		diamond_reward[0].Clear();
		diamond_reward[1].Clear();
		need_gold.Clear();
		need_diamond.Clear();
		guild_boss_actid = 0;
		guild_quit_cd = 0;
		expense[0].Clear();
	}
public:
	int32_t guild_exp;				//公会升级需要经验
	CItemTpl gold_reward[2];		//金币捐献奖励
	CItemTpl diamond_reward[2];		//钻石捐献奖励
	CItemTpl need_gold;				//金币捐献消耗
	CItemTpl need_diamond;			//钻石捐献消耗
	int32_t gold_contribution;		//金币捐献获得贡献
	int32_t diamond_contribution;	//钻石捐献获得贡献
	int32_t gold_sign;				//金币捐献次数
	int32_t diamond_sign;			//钻石捐献次数
	int32_t guild_shop;				//公会商店？
	int32_t upper_limit;			//人数上限
	int32_t guild_boss_actid;		//公会boss活动ID
	int32_t guild_quit_cd;			//退出加入公会CD时间
	CItemExpense expense[4];			//酒品消耗
	Json::Value alcohol_ID;			//酒品id
};

class CUnionBossLv
{
public:
	CUnionBossLv() 
	{
		level_ = 0;
		monsterid_ = 0;
	}
	~CUnionBossLv() {};
	void LoadFromJson(const Json::Value& bossinfo);
	int32_t level() const { return level_; }
	int32_t monsterid() const { return monsterid_; }

	const CItemTplList& award_firstblood()const { return award_firstblood_; }
	const CItemTplList& award_kill()const { return award_kill_; }
	const CItemTplList& award_partake() const { return award_partake_; }
	const CItemTplList& award_num1() const { return award_num1_; }
private:
	int32_t level_;
	int32_t monsterid_;
	CItemTplList award_firstblood_;		//首杀
	CItemTplList award_kill_;			//击杀
	CItemTplList award_partake_;		//参与
	CItemTplList award_num1_;			//第一名
};

class CUnionBossCfg
{
public:
	CUnionBossCfg()
	{
		unionboss_config_.clear();
	}
	const CUnionBossLv* Getbossinfo(int32_t level) const;
	void LoadFromJson(const Json::Value& unioninfo);
private:
	// 等级，配置关系
	std::unordered_map<int32_t, CUnionBossLv> unionboss_config_;
};

// 酒品配置
class CUnionAlcohol
{
public:
	CUnionAlcohol()
	{
		name_alcohol = "";
		icon_alcohol = "";
		skill_id = 0;
		con_time = 0;
		alcohol_id = 0;
	}
public:
	std::string name_alcohol;	//酒名字
	std::string icon_alcohol;	//酒图标
	int32_t skill_id;
	int32_t con_time;
	int32_t alcohol_id;
};

#endif

